package io.renren.modules.weixin.configuration;

import io.renren.modules.weixin.servlet.WeixinServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WeixinConfigure extends SpringBootServletInitializer {

    @Bean("weixinServlet")
    public ServletRegistrationBean servletRegistrationBean(){

        ServletRegistrationBean registration = new ServletRegistrationBean(new WeixinServlet());
        registration.addInitParameter("messageHandleList","com.melinkr.weixin.common.msg.handler.EventMsgHandler,com.melinkr.weixin.common.msg.handler.TextMsgHandler");
        registration.addInitParameter("msgHandlerClass","{\"text\":\"io.renren.modules.weixin.handler.TextReqMsgHandler\"}");
        registration.addUrlMappings("/weixin/wxCall");
        return registration;
    }

}
